import requests

def get_proxy():#从远程服务器获取得代理中随机取一个过来
    try:
        proxy = requests.get('http://119.29.215.39:5010/get/').text
        return proxy
    except Exception as e :
        print('获取代理IP时发生异常:proxy--get_proxy.py--line 3')
        print('异常信息:{}'.format(e))
        return None

def delete_proxy(proxy):#删除一个无效的IP
    try:
        requests.get("http://127.0.0.1:5010/delete/?proxy={}".format(proxy))
    except Exception as e:
        print('删除代理IP时发生异常:proxy--get_proxy.py--line 12')
        print('异常信息:{}'.format(e))
        return -1




